#include "htmlbuilder.h"
#include <QStringList>
#include <QFile>
#include <QTextStream>
#include "css.h"

HtmlBuilder::HtmlBuilder()
{
    loadCSS();
}

void HtmlBuilder::loadCSS()
{
    /*QStringList fileData;
    QFile file("projectview.css");
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
        return;

    QTextStream in(&file);
    while (!in.atEnd())
    {
        QString line = in.readLine();
        fileData.append(line);
    }
    m_CSS = fileData.join("\n");*/
    m_CSS = getCSS();
}


QString HtmlBuilder::getHtml()
{
    QStringList html;
    html << "<html>";
    html << "<head>";
    html << "<meta content=\"width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0\" name=\"viewport\" />";
    html << m_CSS;
    html << "</head>";
    html << "<body>";
    addContent(html);
    html << "</body>";
    html << "</html>";

    return html.join("\n");
}


